//
//  TalkfunTools.h
//  TalkfunMediaPlayerDemo
//
//  Created by LuoLiuyou on 16/7/5.
//  Copyright © 2016年 luoliuyou. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>

@interface TalkfunUtils : NSObject

+ (TalkfunUtils*)shared;

@property(nonatomic,strong)UILabel*sizeLabel;

//获取字符串的MD5
+ (nullable NSString *)md5:(nullable NSString *)string;

//获取data的MD5
+ (nullable NSString*)getMd5_32Bit_Data:(nullable NSData*)data;

//获取时间戳
+ (NSInteger)getTimestamp;

//urlEncode
+ (nullable NSString *)urlencode:(nullable NSString *)input;

//获取手机UUID
+ (nullable NSString *)UUID;

//字典转为字符串
+ (nullable NSString *)jsonEncode:(nullable NSObject *)input;

//根据提供的字符串、最大size和字符串字体大小获取CGRect
+ (CGRect)getRectWithString:(nullable NSString *)string size:(CGSize)size fontSize:(CGFloat)fontSize;

//根据提供的字符串、最大size和字符串字体大小获取CGRect(传入属性值)
+ (CGRect)getRectWithString:(nullable NSString *)string size:(CGSize)size fontSize:(CGFloat)fontSize attributes:(nullable NSDictionary<NSString *, id> *)attributes;
//获取每行的文字
+ (nullable NSArray *)getSeparatedLinesFromtext:(nullable NSString *)text font:(nullable UIFont *)font maxWidth:(CGFloat)maxWidth;
//获取有大图的额外高度
+ (CGFloat)getExtraHeightWithString:(nullable NSString *)string fontSize:(CGFloat)fontSize boundingSize:(CGSize)size row:(NSInteger)row;

//图文混排
+ (nullable NSDictionary *)assembleAttributeString:(nullable NSString *)string boundingSize:(CGSize)size fontSize:(CGFloat)fontSize shadow:(BOOL)shadow;

//提供字节数计算出文件大小
+ (nullable NSString *)fileSizeWithInterge:(NSInteger)size;

//图片修正方向
+ (nullable UIImage *)fixOrientation:(nullable UIImage *)aImage;

//图片压缩
+ (nullable UIImage*)imageWithImage:(nullable UIImage*)image;

//获取图片大小
+ (CGFloat)getSize:(nullable UIImage *)image;

//获取userAgent
- (NSString *_Nullable)getUserAgent;
//获取名字跟时间
+ (NSMutableAttributedString *_Nullable)getUserNameAndTimeWith:(NSDictionary *_Nullable)params playback:(BOOL)playback;
//获取头像urlString
+ (nullable NSString *)getAvatarString:(nonnull NSString *)xid avatarHost:(nonnull NSString *)avatarHost;

+ (BOOL)mkdirs:(NSString *_Nonnull)directory;

+ (BOOL)archivedToFile:(NSString *_Nonnull)file data:(id _Nonnull )data;
//生成图文富文本
+ (NSMutableAttributedString*_Nonnull)getAttributedText:(NSString *_Nullable)str fontSize:(UIFont*_Nullable)font   foregroundColor:(UIColor*_Nullable)color;
//生成图文富文本 新版, 用字体高度
+ (NSMutableAttributedString*_Nonnull)new_getAttributedText:(NSString *)str fontSize:(UIFont*)font foregroundColor:(UIColor*)color ;
//计算富文本
+ (CGSize)sizeLabelToFit:(NSAttributedString *_Nonnull)aString width:(CGFloat)width fontSize:(UIFont*_Nullable)font ;

+ (NSMutableArray*_Nullable)completeStr:(NSString*_Nullable)completeStr   splitArray:(NSArray*_Nonnull)array;
/**
 检测输入的手机号是否正确
 */
+ (NSString *_Nullable)valiMobile:(NSString *_Nullable)mobile;

+(id _Nullable )getJsonDataJsonname:(NSString *_Nullable)jsonname;

+(CGRect)getMainScreen;

//判断是否输入的是url
+(BOOL)isWhetherNoUrl:(NSString *_Nullable)urlStr;

+(NSArray*_Nonnull)getURLFromStr:(NSString *_Nonnull)string;
+ (NSAttributedString*_Nonnull)getInternalFontOfSiz:(CGFloat)size withMsg:(NSString*_Nonnull)msg;
//view转成image
+ (UIImage*_Nullable)imageWithUIView:(UIView*_Nonnull) view;
//指定合作方
+(BOOL)isDesignatedPartner:(NSString*_Nonnull)partner_id;
+ (UIFont*_Nonnull)getFont:(CGFloat)size;

//压缩图片大小
+ (UIImage *)compressImageSize:(UIImage *)image toByte:(NSUInteger)maxLength;

//数据类型转换
+(NSString*)getNewNumber:(NSObject*)obj;


//转换时间
//+(NSString *)getTimestampStr:(NSString*)mStr;
@end
